﻿using SUNRPA.CONTROLS.IMPL.domain.attrubutes;
using SUNRPA.CONTROLS.IMPL.domain.flowRunningVar;
using SUNRPA.CONTROLS.IMPL.util;
using System.Collections.Concurrent;

namespace SUNRPA.CONTROLS.IMPL.domain.flowItemParam {
    [Serializable]
    [VarFieldName("OutVarName")]
    public class OpenInputDiaNParam:BaseParam {
        private string dialogTitle = "";
        private int dialogType = 0;
        private string outVarName = "userInput";
        private string description = "";
        private string defaultContent = "";

        public OpenInputDiaNParam() { 
            this.hasDelegate = true;
            this.delegateType = "RPAVIEW.views.EditPage.flows.OpenInputDiaN.UserInputDialog";
        }
        public string DialogTitle {
            get => dialogTitle; 
            set { 
                dialogTitle = value;
                NotifyPropertyChanged("DialogTitle");
            }  
        }

        public int DialogType {
            get => dialogType; 
            set { 
                dialogType = value;
                NotifyPropertyChanged("DialogType");
            }  
        }
        public string OutVarName {
            get => outVarName; 
            set { 
                outVarName = value;
                NotifyPropertyChanged("OutVarName");
            }  
        }
        public string Description {
            get => description; 
            set { 
                description = value;
                NotifyPropertyChanged("Description");
            }
}
        public string DefaultContent {
            get => defaultContent; 
            set { 
                defaultContent = value;
                NotifyPropertyChanged("DefaultContent");
            }  
        }
        public string GetTranslateDialogType() {
            switch(this.dialogType) {
                case 0:
                    return "文本框";
                case 1:
                    return "密码框";
                case 2:
                    return "多行文本框";
                default : return "文本框";
            }
        }

        public override void SetLatestVarName(ConcurrentDictionary<string, ConcurrentDictionary<string, RPAVariableDefineWrapper>> globleData) {
            this.outVarName = this.GetLatestName(this.outVarName, globleData);
        }
    }
}
